<!DOCTYPE html><html><head><meta content='' name='description'>
        <meta charset='UTF-8'>
        <meta content='True' name='HandheldFriendly'>
        <meta content='width=device-width, initial-scale=1.0' name='viewport'>
        <title><?php echo $title ?> - 管理后台 - <?php echo $settings['site_name'] ?></title>
        <?php $this->load->view('common/header-meta'); ?>
    </head>
    <body id="startbbs">
        <?php $this->load->view('common/header'); ?>
        <div class="container">
            <div class="row">
                <?php $this->load->view('common/sidebar'); ?>
                <div class="col-md-9">
                    <ol class="breadcrumb">
                        <li><a href="<?php echo site_url('admin/login') ?>">管理首页</a></li>
                        <li><a href="<?php echo site_url('admin/teacher') ?>">教师风采列表</a></li>
                        <li class="active">编辑教师风采</li>
                    </ol>
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h3 class="panel-title">编辑教师风采</h3>
                        </div>
                        <div class="panel-body">
                            <form accept-charset="UTF-8" action="<?php echo site_url('admin/teacher/edit/' . $teacher['id']); ?>" class="simple_form form-horizontal" id="edit_user_1" method="post" novalidate="novalidate">
                                <input type="hidden" id="token" name="<?php echo $csrf_name; ?>" value="<?php echo $csrf_token; ?>">
                                <input type="hidden" name="<?php echo $teacher['id']; ?>" value="<?php echo $teacher['id']; ?>">
                                <div class="form-group">
                                    <label class="col-md-3 control-label" for="title">姓名</label>
                                    <div class="col-md-5">
                                        <input class="form-control" id="name" name="title" size="50" type="text" value="<?php echo $teacher['title'] ?>" />
                                    </div>
                                </div>
                                <div class="form-group email optional">
                                    <label class="col-md-3 control-label" for="zhicheng">职称</label>

                                    <div class="col-md-5">
                                        <select class="form-control" name="zhicheng">
                                            <option value="">请选择职称</option>
                                            <?php foreach ($zhicheng as $key => $value) { ?>
                                                <?php if ($value == $teacher['zhicheng']): ?>
                                                    <option selected='selected' value="<?php echo $value; ?>"><?php echo $value; ?></option>
                                                <?php else: ?>
                                                    <option value="<?php echo $value; ?>"><?php echo $value; ?></option>
                                                <?php endif; ?>

                                            <?php } ?>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group email optional">
                                    <label class="col-md-3 control-label" for="pic">图片</label>
                                    <div class="col-md-5">
                                        <input class="form-control" id="pic" name="pic" size="50"   value="<?php echo $teacher['pic'] ?>" />
                                    </div> 
                                    <div style="margin-top: 10px;">
                                        <input id="upload_ico" type="button" value="选择"  class="btn btn-success">
                                        <span>规格为 宽度120像素*高度160像素的图片</span>
                                    </div>
                                </div>
                                <div class="form-group email optional">
                                    <label class="col-md-3 control-label" for="jianjie">简介</label>
                                    <div class="col-md-5">
                                        <input class="form-control" id="jianjie" name="jianjie" size="50"   value="<?php echo $teacher['jianjie'] ?>" />
                                    </div>
                                </div>
                                <div class="form-group email optional">
                                    <label class="col-md-3 control-label" for="o">排序</label>
                                    <div class="col-md-5">
                                        <input class="form-control" id="o" name="o" size="50"   value="<?php echo $teacher['o'] ?>" />
                                    </div>
                                </div>


                                <div class="form-group">
                                    <label class="col-md-3 control-label" for="content">教师风采</label>
                                    <div class="col-md-9">
                                        <textarea class="form-control" style="width: 100%;height: 400px;" id="content" name="content"><?php echo $teacher['content']; ?></textarea>
                                    </div>
                                </div>

                                <div class="form-group string optional">
                                    <label class="col-md-3 control-label" for="user_account_attributes_location">显示/隐藏</label>
                                    <div class="col-md-5">
                                        <label class='radio-inline'>
                                            <input <?php if ($teacher['status'] == '1') { ?> checked="checked"<?php } ?> id="settings_show_community_stats_on" name="status" type="radio" value="1" />显示</label>
                                        <label class='radio-inline'>
                                            <input <?php if ($teacher['status'] == '0') { ?> checked="checked"<?php } ?> id="settings_show_community_stats_off" name="status" type="radio" value="0" />隐藏</label>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-md-offset-3 col-md-9">
                                        <button type="submit" name="commit" class="btn btn-primary">更新教师风采</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div><!-- /.col-md-8 -->

            </div><!-- /.row -->
        </div><!-- /.container -->
        <script type="text/javascript" src="<?php echo base_url('static/kindeditor/kindeditor-all-min.js'); ?>"></script>
        <script>
            jQuery(function ($) {
                var editor = KindEditor.create('textarea[name="content"]', {
                    uploadJson: "<?php echo base_url('static/'); ?>/kindeditor/php/upload_json.php",
                    fileManagerJson: "<?php echo base_url('static/'); ?>/kindeditor/php/file_manager_json.php",
                    allowFileManager: true,
                    urlType: "absolute", //采用域名显示上传的图片
                    afterBlur: function () {
                        this.sync();
                    }
                });
            });
        </script>
        <script src="<?php echo base_url('static/common/js/jquery.upload.js') ?>" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#upload_ico").click(function () {
                    doUpload();
                });
            });
            function doUpload() {
                // 上传方法
                var token = $('#token').val();
                $.upload({
                    // 上传地址
                    url: baseurl + "index.php/upload/upload_pic_xx",
                    // 文件域名字
                    fileName: 'img',
                    // 其他表单数据
                    params: {stb_csrf_token: token},
                    // 上传完成后, 返回json, text
                    dataType: 'json',
                    // 上传之前回调,return true表示可继续上传
                    onSend: function () {
                        return true;
                    },
                    // 上传之后回调
                    onComplate: function (data) {
                        if (data.file_url) {
                            $('#pic').val(data.file_url);
                            alert(data.msg);
                        } else {
                            alert(data.error);
                        }
                    }
                });
            }
        </script>
        <?php $this->load->view('common/footer'); ?>
    </body></html>
